package com.goexcursion.validator

class ParameterValidator {

	def validate(def parameters, def propertyName) {

		def value = parameters?."${propertyName}"
		validateNotNull(value, propertyName)
	}

	def validateNotNull(def value, def propertyName) {
		if(!value) {
			throw new RuntimeException("Parameter ${propertyName} is mandatory.")
		}
	}
}
